import request from '/@/api/request'
/** 服务商管理 */

/** 分页查询服务商列表 */
export const requestGetProviderByPage = (data: GetServiceProviderByPageTypes.IRequest) => {
  return request.post<IPaginationResponse<GetServiceProviderByPageTypes.IResponse[]>>('/manage/openApiServiceProvider/getServiceProviderByPage', data)
}
/** 上线-下线-服务 */
export const requestUpdateServiceProviderState = (data: UpdateServiceProviderStateTypes.IRequest) => {
  return request.post<IBaseResponse<UpdateServiceStateTypes.IResponse>>('/manage/openApiServiceProvider/updateServiceProviderStatus', data)
}
/** 根据uuid查询服务详情 */
export const requestGetServiceProviderByUuid = (data: GetServiceProviderByUuidTypes.IRequest) => {
  return request.post<IBaseResponse<GetServiceByUuidTypes.IResponse>>('/manage/openApiServiceProvider/getServiceProviderByUuid', data)
}
/** 分页查询服务商服务列表 */
export const requestGetProviderServiceByPage = (data: GetProviderServiceByPageTypes.IRequest) => {
  return request.post<IPaginationResponse<GetProviderServiceByPageTypes.IResponse[]>>('/manage/openApiService/providerGetServiceByPage', data)
}
/** 分页查询服务商订阅列表 */
export const requestGetSubByService = (data: SubByServiceApiTypes.IRequest) => {
  return request.post<IPaginationResponse<SubByServiceApiTypes.IResponse[]>>('/manage/openApiSub/getSubByService', data)
}

/** 服务商接口访问记录 */
export const requestProviderInterfaceRecord = (data: ProviderInterfaceAccessRecordApiTypes.IRequest) => {
  return request.post<IBaseResponse<ProviderInterfaceAccessRecordApiTypes.IResponse>>('/openApiInterfaceLog/getServiceInterfaceLogByPage', data)
}
/** 接口访问统计Echarts */
export const getProviderAccessStatisticsTimeChart = (data) => {
  return request.post<IBaseResponse<ProviderInterfaceAccessRecordApiTypes.IResponse>>('/openApiInterfaceLog/getServiceInterfaceStatisticsChart', data)
}

/** 接口实时访问表格 */
export const requestProviderRealtimeRecord = () => {
  return request.get<IBaseResponse<InterfaceAccessRecordApiTypes.IResponse>>('/openApiInterfaceLog/getServiceInterfaceFlowStatistics')
}
/** 接口实时访问柱状图 */
export const getProviderInterfaceFlowStatisticsChart = () => {
  return request.get<IBaseResponse<InterfaceAccessRecordApiTypes.IResponse>>('/openApiInterfaceLog/getServiceInterfaceFlowStatisticsChart')
}
/** 接口访问统计表格分页 */
export const requestProviderInterfaceStatisticsByPage = (data) => {
  return request.post<IBaseResponse<InterfaceAccessRecordApiTypes.IResponse>>('/openApiInterfaceLog/getServiceInterfaceStatisticsByPage', data)
}
